import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:${USER}
 * Date:${YEAR}-${MONTH}-${DAY}
 * ${TIME}
 */
public class Main {

    public String longestCommonPrefix(String[] strs) {

    for(int i=0;i<strs[0].length();i++){
        char tmp=strs[0].charAt(i);
        for(int j=1;j<strs.length;j++){
            if(i==strs[j].length()||tmp!=strs[j].charAt(i)){
                return strs[0].substring(0,i);
            }
        }
    }
    return strs[0];
}
}